<%@ Page Language="C#" MasterPageFile="~/_Templates/MasterPages/Default.master" AutoEventWireup="true" CodeFile="crop.aspx.cs" Inherits="image_manipulation_crop" Title="Untitled Page" %>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContentPlaceHolder" Runat="Server" EnableViewState="false">

<h1>Image Manipulation</h1>
<h2>Crop</h2>
<p>Using the <strong>ImageTransform</strong> control you can crop your images.</p>

<h3>Original Image</h3>
<img src="../_client/images/egypt.jpg" width="720" height="455" />

<h3>Cropped</h3>
<h4>aspx</h4>
<pre class="csharpcode">
<span class="kwrd">&lt;</span><span class="html">DNAide:ImageTransform</span> <span class="attr">ID</span><span class="kwrd">="Crop1"</span> <span class="attr">runat</span><span class="kwrd">="server"</span> <span class="attr">SourceFileName</span><span class="kwrd">="~/_client/images/egypt.jpg"</span> 
  <span class="attr">OutputFileName</span><span class="kwrd">="Crop1.jpg"</span> <span class="kwrd">/&gt;</span></pre>
<h4>codebehind</h4>
<pre class="csharpcode">
<span class="kwrd">protected</span> <span class="kwrd">override</span> <span class="kwrd">void</span> OnInit(EventArgs e)
{
  Crop1.ApplyTransformations += 
    <span class="kwrd">new</span> DNAideImageControl.ApplyTransformationsEventHandler(Crop1_ApplyTransformations);
        <span class="kwrd">base</span>.OnInit(e);
}

<span class="kwrd">void</span> Crop1_ApplyTransformations(<span class="kwrd">object</span> sender, <span class="kwrd">ref</span> Bitmap bitmapToTransform)
{
  bitmapToTransform = BitmapAide.Crop(bitmapToTransform, 290, 205, 164, 160);
}</pre>

<DNAide:ImageTransform ID="Crop1" runat="server" SourceFileName="~/_client/images/egypt.jpg" OutputFileName="Crop1.jpg" WriteOption="Overwrite" />


</asp:Content>

